home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
FishMarket 1.0
/
FishMarket v1.0.iso
/
fishies
/
301-325
/
disk_319
/
cnewssrc
/
cnews.orig.lzh
/
libc
/
warning.c
< prev
Wrap
C/C++ Source or Header
|
1989-06-27
|
634b
|
30 lines
/*
* warning - print best error message possible and clear errno
*/
#include <stdio.h>
void
warning(s1, s2)
char *s1;
char *s2;
{
char *cmdname;
extern int errno, sys_nerr;
extern char *sys_errlist[];
extern char *progname;
extern char *getenv();
(void) fflush(stdout); /* hack */
cmdname = getenv("CMDNAME");
if (cmdname != NULL && *cmdname != '\0')
fprintf(stderr, "%s:", cmdname); /* No space after :. */
if (progname != NULL)
fprintf(stderr, "%s: ", progname);
fprintf(stderr, s1, s2);
if (errno > 0 && errno < sys_nerr)
fprintf(stderr, " (%s)", sys_errlist[errno]);
fprintf(stderr, "\n");
errno = 0;
}